package org.apache.harmony.javax.security.auth.callback;

import java.io.Serializable;

public class ChoiceCallback
  implements Serializable, Callback
{
  private static final long serialVersionUID = -3975664071579892167L;
  private int defaultChoice;
  private String prompt;
  private boolean multipleSelectionsAllowed;
  private String[] choices;
  private int[] selections;

  private void setChoices(String[] paramArrayOfString)
  {
    if ((paramArrayOfString == null) || (paramArrayOfString.length == 0))
      throw new IllegalArgumentException("auth.1C");
    for (int i = 0; i < paramArrayOfString.length; i++)
      if ((paramArrayOfString[i] == null) || (paramArrayOfString[i].length() == 0))
        throw new IllegalArgumentException("auth.1C");
    this.choices = paramArrayOfString;
  }

  private void setPrompt(String paramString)
  {
    if ((paramString == null) || (paramString.length() == 0))
      throw new IllegalArgumentException("auth.14");
    this.prompt = paramString;
  }

  private void setDefaultChoice(int paramInt)
  {
    if ((paramInt < 0) || (paramInt >= this.choices.length))
      throw new IllegalArgumentException("auth.1D");
    this.defaultChoice = paramInt;
  }

  public ChoiceCallback(String paramString, String[] paramArrayOfString, int paramInt, boolean paramBoolean)
  {
    setPrompt(paramString);
    setChoices(paramArrayOfString);
    setDefaultChoice(paramInt);
    this.multipleSelectionsAllowed = paramBoolean;
  }

  public boolean allowMultipleSelections()
  {
    return this.multipleSelectionsAllowed;
  }

  public String[] getChoices()
  {
    return this.choices;
  }

  public int getDefaultChoice()
  {
    return this.defaultChoice;
  }

  public String getPrompt()
  {
    return this.prompt;
  }

  public int[] getSelectedIndexes()
  {
    return this.selections;
  }

  public void setSelectedIndex(int paramInt)
  {
    this.selections = new int[1];
    this.selections[0] = paramInt;
  }

  public void setSelectedIndexes(int[] paramArrayOfInt)
  {
    if (!this.multipleSelectionsAllowed)
      throw new UnsupportedOperationException();
    this.selections = paramArrayOfInt;
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.apache.harmony.javax.security.auth.callback.ChoiceCallback
 * JD-Core Version:    0.6.1
 */